package com.ymh.spring.learn.aop.aspect;

import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class TxAspect {

	@Pointcut("execution(** com.ymh.spring.learn.aop.service.Hello.sayHello(..))")
	public void point() {

	}

	@Before("point()")
	public void slienceCellPhones() {
		System.out.println("关掉手机");
	}

	@Before("point()")
	public void takeSeats() {
		System.out.println("找到座位");
	}

	@AfterReturning("point()")
	public void applause() {
		System.out.println("表演很精彩");
	}

	@AfterThrowing("point()")
	public void demandRefund() {
		System.out.println("退款");
	}

	@Around("point()")
	public void around() {
		System.out.println("环绕通知");
	}

}
